﻿using Windows.UI.Xaml;
using Windows.UI.Xaml.Controls;

// “用户控件”项模板在 http://go.microsoft.com/fwlink/?LinkId=234236 上提供

namespace XnReader.WinRT.Controlx
{
    public sealed partial class Header : UserControl
    {
        public delegate void HeaderEventHandler(object sender, RoutedEventArgs e);

        public event HeaderEventHandler ImportClickEvent;

        //public event HeaderEventHandler DeleteClickEvent;

        //public event HeaderEventHandler CleanClickEvent;

        public Header()
        {
            InitializeComponent();
        }

        private void BtnClick(object sender, RoutedEventArgs e)
        {
            var button = sender as Button;
            if (button == null) return;
            switch (button.Name)
            {
                case "btnOnlineStore":
                    {
                        //导航到在线首页
                        var rootFrame = Window.Current.Content as Frame;
                        if (rootFrame != null) rootFrame.Navigate(typeof (Index));
                    }
                    break;
                case "btnImport": //导入
                    {
                        if (ImportClickEvent != null)
                            ImportClickEvent(this, e);
                    }
                    break;
                //case "btnClean":
                //    {
                //        if (CleanClickEvent != null)
                //            CleanClickEvent(this, e);
                //    }
                //    break;
                //case "btnDelete":
                //    {
                //        if (DeleteClickEvent != null)
                //            DeleteClickEvent(this, e);
                //    }
                //    break;
            }
        }
    }

    public class HeaderInfo
    {
        private Visibility _visibleLogo = Visibility.Collapsed;

        public Visibility VisibleLogo
        {
            get { return _visibleLogo; }
            set { _visibleLogo = value; }
        }

        private Visibility _visibleOnlineStore = Visibility.Collapsed;

        public Visibility VisibleOnlineStore
        {
            get { return _visibleOnlineStore; }
            set { _visibleOnlineStore = value; }
        }

        private Visibility _visibleImport = Visibility.Collapsed;

        public Visibility VisibleImport
        {
            get { return _visibleImport; }
            set { _visibleImport = value; }
        }

    //    private Visibility _visibleDelete = Visibility.Collapsed;

    //    public Visibility VisibleDelete
    //    {
    //        get { return _visibleDelete; }
    //        set { _visibleDelete = value; }
    //    }

    //    private Visibility _visibleClean = Visibility.Collapsed;

    //    public Visibility VisibleClean
    //    {
    //        get { return _visibleClean; }
    //        set { _visibleClean = value; }
    //    }
    }
}
